#ifndef SILKSOURCE_H
#define SILKSOURCE_H
#include <string.h>
#include <stdlib.h>
#include <SKP_Silk_control.h>
#include <SKP_Silk_SDK_API.h>
#include <SKP_Silk_errors.h>
#include <SKP_Silk_typedef.h>
#include <stdio.h>
#include <string>

using namespace std;
#define EXTRACT_16BITS(p) \
    ((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \
                ((uint16_t)(*((const uint8_t *)(p) + 1)) << 0)))

class SilkSource
{
private:
    SKP_SILK_SDK_DecControlStruct mDecControl;
    FILE *mInFile;
    string mInFileName;
    SKP_int32 packetSize_ms;

    void *mSilkDec;

    int check_header();
public:
    SilkSource();
    ~SilkSource();
    int init(char *src);
    int decode_apacket(uint8_t *frame, int *size);

};

#endif // SILKSOURCE_H
